//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.eResearch.RuntimeServices.Monitoring
{
    using System;

    public interface IResourceMonitor
    {
        /// <summary>
        /// Gets the time span between calls to MonitorResource.
        /// </summary>
        /// <value>The monitor time span.</value>
        TimeSpan MonitorTimeSpan { get; }

        /// <summary>
        /// Sets up the resource monitor.
        /// </summary>
        void Setup();

        /// <summary>
        /// Tears down the resource monitor.
        /// </summary>
        void Teardown();

        /// <summary>
        /// Called after every MonitorTimeSpan elapses.  Allows the monitor to discover resources.
        /// The method returns true if it is ready to have GetResource() called, false otherwise.
        /// For example, this allows the monitor to grab data out of the system 10 times, keeping
        /// an average (and returning false), then then return true on the 10th time so that
        /// GetResource() will be called.
        /// </summary>
        /// <param name="monitorEvent">The monitor event.</param>
        /// <returns>
        /// true if GetResource should be called, otherwise, false
        /// </returns>
        bool MonitorResource(ActivityMonitorEvent monitorEvent);

        /// <summary>
        /// Gets the resource from the monitor.
        /// </summary>
        /// <returns>The resource as a string.</returns>
        string GetResource();
    }
}
